package bootstrap

import (
	"github.com/gorilla/mux"
	"goblog/pkg/route"
	"goblog/routes"
	"net/http"
)

// SetupRoute 路由初始化
func SetupRoute() *mux.Router {
	router := mux.NewRouter()

	routes.RegisterWebRoutes(router)

	// 中间件：强制内容类型为 HTML
	//router.Use(middlewares.ForceHTML)

	// 静态资源 js 和 css
	router.PathPrefix("/css/").Handler(http.FileServer(http.Dir("./public")))
	router.PathPrefix("/js/").Handler(http.FileServer(http.Dir("./public")))

	route.SetRoute(router)

	return router
}
